import Vue from 'vue';
import Element from 'element-ui';

import Utils from '@/utils'
import LocalConfig from '@/utils/localConfig';
import Msg from '@/utils/msg';
import Validate from '@/utils/validate';
// import Storage from '@/utils/storage';

import * as filters from '@/utils/filters';

// Vue注册变量
let main = {
    install(Vue) {
        Vue.prototype.$utils = Utils;
        Vue.prototype.$localConfig = LocalConfig;
        Vue.prototype.$msg = Msg;
        Vue.prototype.$validate = Validate;
        // Vue.prototype.$storage = Storage;
    }
};

Vue.use(Element);
Vue.use(main);

// 注册过滤
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key])
});

export default ({ app }, inject) => {
    app.$utils = Utils;
    app.$localConfig = LocalConfig;
    app.$msg = Msg;
    app.$validate = Validate;
    // app.$storage = Storage;
}